<?php
namespace app\commands;
use \app\commands\BaseController;
use \app\models\Pay\PayOrder;
use \app\common\services\PayOrderService;
class PayController extends BaseController
{
    //查找库存超过30分钟的
    public function actionUpdate_stock()
    {
     	
      $befer_half_date=time()-60*30;
      $list=PayOrder::find()->select('id')->where(['target_type'=>1,'status'=>-8])->andWhere(['<=','created_time',$befer_half_date])->all();
      if(!$list){
      		return $this->echoLog("no user data");
      }
      foreach($list as $v){
      	
      	 PayOrderService::backStock($v->id);
      }
      return $this->echoLog('its over');
    }
    
}
